package edu.biwu.dao.impl;

import edu.biwu.dao.StudentDao;
import edu.biwu.po.Student;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

/**
 * @author 王俊彪
 * @version 1.0
 */
public class StudentDaoImpl implements StudentDao {
    private SqlSessionFactory sqlSessionFactory;

    public StudentDaoImpl(SqlSessionFactory sqlSessionFactory) {
        this.sqlSessionFactory = sqlSessionFactory;
    }

    @Override
    public Student findBySno(int sno) {
         return sqlSessionFactory.openSession().selectOne("test.findBySno",sno);
    }

    @Override
    public List<Student> findBySname(String sname) {
        return sqlSessionFactory.openSession().selectList("test.findBySname",sname);
    }
}
